//
//  WKTransactionTableViewCell.m
//  ourToken
//
//  Created by wakeup on 2018/5/31.
//  Copyright © 2018年 ourtoken. All rights reserved.
//

#import "WKTransactionTableViewCell.h"
#import "WKBaseHeader.h"

@implementation WKTransactionTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.status.textColor = [UIColor orangeColor];
    self.status.layer.borderColor = [[UIColor orangeColor] CGColor];
    self.status.layer.borderWidth = 1;
}

- (void)setTransactionModel:(WKTransactionModel *)transactionModel {
    _transactionModel = transactionModel;
    
    if (transactionModel.txType == 1) {
        self.transactionImageView.image = [UIImage imageNamed:@"jin"];
    }
    else {
        self.transactionImageView.image = [UIImage imageNamed:@"chu"];
    }
    
    if ([transactionModel.status intValue] == 1) {
        self.status.text = @"交易完成";
    }
    else {
        self.status.text = @"交易中";
    }
    
    if (transactionModel.address.name == nil) {
        self.nameAndAddress.text = [NSString stringWithFormat:@"%@",transactionModel.address.address];
    }
    else {
        self.nameAndAddress.text = [NSString stringWithFormat:@"%@ (%@)",transactionModel.address.name,transactionModel.address.address];
    }
    
    self.coinType.text = transactionModel.coinType;
    self.amount.text = transactionModel.amount;
    self.createdDate.text = [NSString stringWithFormat:@"%@",[transactionModel.createdDate substringToIndex:10]];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
